import 'package:hinge/common/index.dart';

class VideoCommentModel {
  final String id;
  final int videoId;
  final int userId;
  final String content;
  final DateTime createdAt;

  VideoCommentModel({
    required this.id,
    required this.videoId,
    required this.userId,
    required this.content,
    required this.createdAt,
  });

  // 从JSON构造
  factory VideoCommentModel.fromJson(Map<String, dynamic> json) {
    return VideoCommentModel(
      id: json['id'],
      videoId: json['videoId'],
      userId: json['userId'],
      content: json['content'],
      createdAt: DateTime.parse(json['createdAt']),
    );
  }

  // 转换为JSON
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'videoId': videoId,
      'userId': userId,
      'content': content,
      'createdAt': createdAt.toIso8601String(),
    };
  }
}
